import React, { useState, useEffect } from 'react';
import { resourcePath } from '../../../../../../../utils/resource';
import { DownOutlined } from '@ant-design/icons';
import { Route, Switch, Redirect, useLocation, useHistory } from "react-router-dom";
import { Button, Table, Descriptions, Divider, InputNumber, Radio, Dropdown, Space, Input } from 'antd';
import useBusinessMap from '../../../../../../common/BusinessMap/useBusinessMap';
import JcyjApi from '../../../../../../../utils/apis/JcyjApi';
import { navByWkt } from '../../../../../../../utils/helper/mapHelper';

export default function Dzpg(props) {
    const [datas, setDatas] = useState();
    const [total, setTotal] = useState();
    const [params, setParams] = useState({
        pageSize: 5,
        pageNum: 1
    });
   
    const map = useBusinessMap();
    useEffect(() => {
        JcyjApi.dzpg_findby(params).then(resp => {
            setDatas(resp.data);
            setTotal(resp.data2?.totalSize);
        })

    }, [params])
    return <>
    
        <div className='dzpg-div' style={{
            width: 550,
            height: 320,
            position: 'absolute',
            top: 50,
            left: 10,
            bottom: 30,
            overflow: 'auto',
            background: 'rgba(1,15,31,0.5)',
            borderRadius:8,
          
        }}>
                    <div className='fill h0' style={{
                        padding: 12
                    }}>
                        <Table bordered size='small' columns={
                            [
                                {
                                    title: '序号',
                                    dataIndex: 'xh',
                                    render: (text) => {
                                        return text
                                    }

                                },
                                {
                                    title: '地震区域',
                                    dataIndex: 'dzqy',
                                    render: (text) => {
                                        return text
                                    }
                                },
                                {
                                    title: '震级',
                                    dataIndex: 'zj',
                                    render: (text) => {
                                        return text
                                    }
                                },
                                {
                                    title: '震源深度',
                                    dataIndex: 'zysd',
                                    render: (text) => {
                                        return text + 'km'
                                    }
                                }, {
                                    title: '操作',
                                    dataIndex: 'cz',
                                    render: (text) => {
                                        return text
                                    }
                                }
                            ]
                        } dataSource={datas}
                            onRow={record => {
                                return {
                                    onClick: e => {
                                        if (record.shp) {
                                            navByWkt(record.shp, map)
                                        }
                                    }
                                }
                            }}
                            pagination={{
                                current: params.pageNum,
                                pageSize: params.pageSize,
                                total,
                                simple: true,
                                onChange: (page) => {
                                    setParams(params => {
                                        return {
                                            ...params,
                                            pageNum: page
                                        }
                                    })
                                }
                            }} />
                    </div>
                
        </div>
        
       



        


    </>
}